/**
 * 
 */
package org.thinkingupinside.jarme.views;

import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.part.ViewPart;
import swing2swt.layout.BorderLayout;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Table;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TableViewerColumn;
import org.eclipse.jface.layout.TableColumnLayout;
import org.eclipse.swt.widgets.Group;
import swing2swt.layout.FlowLayout;
import org.eclipse.swt.widgets.Button;

/**
 * @author amr
 *
 */
public class JarView extends ViewPart {
	private Table table;

	/**
	 * 
	 */
	public JarView() {
		// TODO Auto-generated constructor stub
	}

	/* (non-Javadoc)
	 * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
	 */
	@Override
	public void createPartControl(Composite parent) {
		parent.setLayout(new BorderLayout(0, 0));
		
		Composite composite = new Composite(parent, SWT.NONE);
		composite.setLayoutData(BorderLayout.CENTER);
//		composite.setLayout(new TableColumnLayout());
		
		TableViewer tableViewer = new TableViewer(composite, SWT.BORDER | SWT.FULL_SELECTION);
		table = tableViewer.getTable();
		table.setHeaderVisible(true);
		table.setLinesVisible(true);
		createColumns(tableViewer);
		
		Group group = new Group(parent, SWT.NONE);
		group.setLayoutData(BorderLayout.SOUTH);
		group.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
		
		Button btnExport = new Button(group, SWT.NONE);
		btnExport.setText("Export");
		// TODO Auto-generated method stub

	}

	private void createColumns(TableViewer tableViewer) {
		TableViewerColumn col1 = new TableViewerColumn(tableViewer, SWT.NONE);
		col1.getColumn().setText("");
		
		TableViewerColumn col2 = new TableViewerColumn(tableViewer, SWT.NONE);
		col1.getColumn().setText("Element");

	}

	/* (non-Javadoc)
	 * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
	 */
	@Override
	public void setFocus() {
		// TODO Auto-generated method stub

	}

}
